package com.mfoyou.agent.web.utils.withdraw;

import java.util.Date;

import org.mfoyou.agent.common.dao.domain.HuawuExtract;
import org.mfoyou.agent.common.entity.enums.CommonState;

import com.mfoyou.agent.web.service.order.PaymentService;

public class PushListner implements WithDrawListener {

    HuawuExtract huawuExtract;

    PaymentService paymentService;

    public PushListner(HuawuExtract huawuExtract, PaymentService paymentService) {
        super();
        this.huawuExtract = huawuExtract;
        this.paymentService = paymentService;
    }

    @Override
    public void success(String message) {
        huawuExtract.setExtractState(CommonState.emauitSucess.getValue());
        huawuExtract.setExtractPayTime(new Date());
        huawuExtract.setExtractRemark("");
        paymentService.modifyExtract(huawuExtract);
    }

    @Override
    public void fail(String message) {
        huawuExtract.setExtractRemark(message);
        huawuExtract.setExtractAuditResult(0);
        huawuExtract.setExtractState(CommonState.emauitfail.getValue());
        paymentService.modifyExtract(huawuExtract);
    }

}
